<template>
	<view>
		<view class="nav">
			<view @click="back"> ← 返回</view>
			<view>我的合同</view>
		</view>
		<view class="item" v-for="(item,index) in lists" :key='index' @click="tz(item)">
			<view>
				<view><image src="../../../static/logo.png" mode=""></image></view>
				<view>
					<view>{{item.name}}</view>
					<view>{{item.stime}} - {{item.etime}}</view>
				</view>
			</view>
			<view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import { reactive, toRefs } from 'vue'
	import http from '../../../../utils/http.js'
	import store from '../../../../store/index.js'
	export default {
		setup(){
			let data = reactive({
				lists:[
				],
				tz:(e)=>{
					uni.navigateTo({
						url: '/pages/wxz/mys/hetong/hetongxiangqing/hetongxiangqing',
						success:function(x){
							x.eventChannel.emit('ht', { ...e })
						}
					});
				},
				back:()=>{
					uni.navigateBack({
						delta:getCurrentPages().length
					})
				}
			})
			return {...toRefs(data)}
		},
	onShow(){
		this.lists=[]
		http({
			url:'/users/htSel',
			method:'post',
			data:{
				name:store.getters.getUser.guanli_hymc
			}
		}).then((e)=>{
			let data=e.data.data
			for(let i=0;i<data.length;i++){
				this.lists.push({
					name:data[i].lease_fh,
					stime:data[i].lease_zlsj.split('/')[0],
					etime:data[i].lease_zlsj.split('/')[1]
				})
			}
			
		})
	}	
	}
</script>

<style scoped lang="less">
.nav{
	padding-top: 60rpx;
	padding-bottom: 20rpx;
	background-color: #F8F8F8;
	display: flex;
	position: relative;
	justify-content: center;
	>view:first-child{
		position: absolute;
		left: 0;
		color: #168ADE;
	}
}
.item{
	display: flex;
	justify-content: space-between;
	padding: 20rpx;
	border-bottom: 1px solid #D9D9D9;
	>view{
		display: flex;
		>view>view{
			margin-top: 10rpx;
		}
		>view>view:last-child{
			font-size: 30rpx;
			color: #D4D4D4;
		}
	}
	image{
		margin-right: 30rpx;
		width: 120rpx;
		height: 120rpx;
	}
}
</style>
